Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Add partialMock shorthand #30202

Merged
merged 1 commit into from
Oct 8, 2019
Merged

[6.x] Add partialMock shorthand #30202

merged 1 commit into from
Oct 8, 2019

Conversation

Plytas
Copy link
Contributor

@Plytas Plytas commented Oct 7, 2019

This is similar to mock() but it makes a partial mock. Method name could also be changed to mockPartial()

So instead of

$this->instance(Abstract::class, Mockery::mock(Abstract::class, function ($mock) {
    $mock->shouldReceive('call')->once();
})->makePartial());

You can write

$this->partialMock(Abstract::class, function ($mock) {
    $mock->shouldReceive('call')->once();
});

This is similar to `mock()` but it makes a partial mock. Method name could also be changed to `mockPartial()`

So instead of
```PHP
$this->instance(Abstract::class, Mockery::mock(Abstract::class, function ($mock) {
    $mock->shouldReceive('call')->once();
})->makePartial());
```

You can write
```PHP
$this->partialMock(Abstract::class, function ($mock) {
    $mock->shouldReceive('call')->once();
});
```
@driesvints driesvints changed the title Add partialMock shorthand [6.x] Add partialMock shorthand Oct 7, 2019
@taylorotwell taylorotwell merged commit 850dffc into laravel:6.x Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants